package io.summer.demo.service;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * @author Moonlight
 */
@Slf4j
@Service
public class TestService {
  @Cacheable(cacheNames = "tv")
  public String getValue() {
    log.info("get value ");
    return "hahaha";
  }

  @Cacheable(cacheNames = "tv")
  public TestVo getTestVo() {
    log.info("get TestVo ");
    TestVo vo = new TestVo();
    vo.setA(getValue());
    return vo;
  }

  public static class TestVo implements Serializable {
    @Getter
    @Setter
    private String a;

    private int b = 3;
  }
}
